<template>
  <!-- 迷路元素 -->
  <div
    class="lost-element"
    v-for="(element, index) in floatingElements"
    :key="index"
    :style="{
      top: element.top + 'px',
      left: element.left + 'px',
      animationDelay: index * 0.5 + 's',
    }">
    <div class="cat-paw" v-if="isDayTheme"></div>
    <div class="twinkle-star" v-else></div>
  </div>

  <!-- 404内容 -->
  <div class="error-container">
    <div class="error-code">404</div>
    <h1 class="error-title">前面的区域，以后再来探索吧~</h1>
    <p class="error-description">也许它从未存在，也许它已去往别处。</p>
    <Button text="返回主页" icon="fas fa-home" @click-it="router.push('/home')"></Button>
  </div>
</template>

<script setup>
import { useRouter } from "vue-router"
import appStore from "@/stores"
import { storeToRefs } from "pinia"
import Button from "@/components/Button.vue"
const router = useRouter()
const { isDayTheme } = storeToRefs(appStore.homeviewStore)
// 返回首页
const goHome = () => {
  router.push("/home")
}
</script>

<style scoped>
.error-container {
  text-align: center;
  padding: 40px;
  background: var(--card-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--border-radius);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  z-index: 10;
}

.error-container::before {
  content: "";
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: linear-gradient(
    45deg,
    transparent 0%,
    rgba(var(--primary-rgb), 0.1) 50%,
    transparent 100%
  );
  z-index: -1;
  animation: gradientShift 12s ease infinite;
}

@keyframes gradientShift {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* 404数字 */
.error-code {
  font-size: 120px;
  font-weight: 800;
  color: var(--primary);
  text-shadow: 0 5px 15px rgba(var(--primary-rgb), 0.3);
  margin-bottom: 20px;
  line-height: 1;
  position: relative;
  display: inline-block;
}

.error-code::after {
  content: "";
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 8px;
  background: var(--secondary);
  border-radius: 4px;
  opacity: 0.6;
}

/* 错误标题 */
.error-title {
  font-size: 36px;
  margin-bottom: 25px;
  color: var(--text);
  position: relative;
  display: inline-block;
  padding-bottom: 15px;
}

.error-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 3px;
  background: var(--secondary);
  border-radius: 2px;
}

/* 错误描述 */
.error-description {
  font-size: 18px;
  color: var(--gray);
  margin-bottom: 35px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.7;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .error-code {
    font-size: 90px;
  }

  .error-title {
    font-size: 28px;
  }

  .error-description {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .error-code {
    font-size: 70px;
  }

  .error-title {
    font-size: 24px;
  }

  .error-container {
    padding: 30px 20px;
  }
}
</style>
